package com.dianping.cat.configuration.reload.transform;

import com.dianping.cat.configuration.reload.entity.ReportPeriod;
import com.dianping.cat.configuration.reload.entity.ReportReloadConfig;
import com.dianping.cat.configuration.reload.entity.ReportType;
import org.xml.sax.Attributes;



public class DefaultSaxMaker
  extends Object
  implements IMaker<Attributes>
{
  public ReportPeriod buildReportPeriod(Attributes attributes) {
/* 15 */     String id = attributes.getValue("id");
/* 16 */     ReportPeriod reportPeriod = new ReportPeriod();

/* 18 */     if (id != null) {
/* 19 */       reportPeriod.setId(id);
    }

/* 22 */     return reportPeriod;
  }



/* 27 */   public ReportReloadConfig buildReportReloadConfig(Attributes attributes) { return new ReportReloadConfig(); }





  public ReportType buildReportType(Attributes attributes) {
/* 34 */     String id = attributes.getValue("id");
/* 35 */     return new ReportType(id);
  }




  protected <T> T convert(Class<T> type, String value, T defaultValue) {
/* 42 */     if (value == null || value.length() == 0) {
/* 43 */       return defaultValue;
    }

/* 46 */     if (type == Boolean.class || type == boolean.class)
/* 47 */       return (T)Boolean.valueOf(value); 
/* 48 */     if (type == Integer.class || type == int.class)
/* 49 */       return (T)Integer.valueOf(value); 
/* 50 */     if (type == Long.class || type == long.class)
/* 51 */       return (T)Long.valueOf(value); 
/* 52 */     if (type == Short.class || type == short.class)
/* 53 */       return (T)Short.valueOf(value); 
/* 54 */     if (type == Float.class || type == float.class)
/* 55 */       return (T)Float.valueOf(value); 
/* 56 */     if (type == Double.class || type == double.class)
/* 57 */       return (T)Double.valueOf(value); 
/* 58 */     if (type == Byte.class || type == byte.class)
/* 59 */       return (T)Byte.valueOf(value); 
/* 60 */     if (type == Character.class || type == char.class) {
/* 61 */       return (T)Character.valueOf(value.charAt(0));
    }
/* 63 */     return (T)value;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-core-3.0.0.jar!/com/dianping/cat/configuration/reload/transform/DefaultSaxMaker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */